import 'user_store.dart';
import 'challenge_store.dart';
import 'event_store.dart';
import 'dynamic_store.dart';
import 'club_store.dart';
import 'checkin_store.dart';
import 'follow_store.dart';
import 'chat_store.dart';

/// 全局应用状态管理
class AppState {
  static final AppState _instance = AppState._internal();

  factory AppState() {
    return _instance;
  }

  AppState._internal();

  /// 用户状态管理实例
  final UserStore userStore = UserStore();

  /// 任务管理器实例
  final QuestManager questManager = QuestManager();

  /// 聚会组织者实例
  final GatheringOrganizer gatheringOrganizer = GatheringOrganizer();

  /// 动态发布者实例
  final ContentBroadcaster contentBroadcaster = ContentBroadcaster();

  /// 俱乐部管理者实例
  final ClubManager clubManager = ClubManager();

  /// 打卡追踪器实例
  final CheckinTracker checkinTracker = CheckinTracker();

  /// 关注管理器实例
  final FollowManager followManager = FollowManager();

  /// 单聊协调器实例
  final ChatCoordinator chatCoordinator = ChatCoordinator();

  /// 初始化应用状态
  void initializeApp() {
    // 初始化用户数据
    userStore.initializeDefaultUsers();
    // 初始化任务数据
    questManager.initializeDefaultQuests();
    // 初始化聚会数据
    gatheringOrganizer.initializeDefaultGatherings();
    // 初始化动态数据
    contentBroadcaster.populateDefaultContent();
    // 初始化俱乐部数据
    clubManager.initializeDefaultClubs();
    // 初始化打卡数据
    checkinTracker.initializeDefaultCheckins();
    // 初始化关注数据
    followManager.initializeDefaultFollows();
    // 初始化聊天数据
    chatCoordinator.initializeDefaultChats();
  }
}

/// 全局状态管理实例
final appState = AppState();
